<?xml version="1.0" encoding="UTF-8" ?>
<%@page import="javax.servlet.jsp.jstl.fmt.LocalizationContext"%>
<%@page import="java.util.ResourceBundle"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@ page import="org.jakim.entity.*"%>
<%@ page import="org.jakim.utils.*"%>
<%@page import="org.apache.taglibs.standard.tlv.JstlCoreTLV"%>
<%@page import="org.apache.taglibs.standard.tlv.JstlFmtTLV"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<fmt:setLocale value="en" />
<fmt:setBundle basename="org.jakim.messages.messages" var="msg"
	scope="session" />
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<link href="../styles/main.css" rel="stylesheet" type="text/css" />
<link href="../styles/wizard.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script type="text/javascript">

$(function() {
    $( "#modalForm" ).dialog({
		autoOpen: false,
		title: 'Dialog Title',
		height: 'auto',
		width: 'auto',
		modal: true,
		show: {
        effect: "blind",
        duration: 1000
      },
      hide: {
        effect: "explode",
        duration: 1000
      }
    });
 
    $( "#addButton" ).click(function() {
      $( "#modalForm" ).dialog( "open" );
    });
  });
  
</script>
</head>
<body>
	<%
	HttpSession httpSeesion = request.getSession();
	List<WorkExperience> listWorkExperience = null;
	
	Object objWrokExperience = httpSeesion.getAttribute("attrWrokExperience");
	
	if (objWrokExperience == null){
		listWorkExperience = new ArrayList<WorkExperience>();
		httpSeesion = request.getSession();
	}else{
		if(objWrokExperience instanceof List<?>){
			listWorkExperience = (List<WorkExperience>) objWrokExperience;
		}
	}
%>
	<div id="divBodyContainer">
		<h1>
			<fmt:message key="WORKEXPERIENCE.HEADER" />
		</h1>

		<p>
			<fmt:message key="WORKEXPERIENCE.SUMMARY" />
		</p>

		<button id="addButton">
			<fmt:message key="WORKEXPERIENCE.ADDEXPERIENCE.BUTTON" />
		</button>

		<div class="wizardHistoryBody">
			<%
	   			if (listWorkExperience != null && listWorkExperience.size() > 0){
	   				%>
			<table id="addedWorkTable" class="userEntriesTable">
				<tr>
					<th><fmt:message
							key="WORKEXPERIENCE.EPERIENCE.TABLE.HEADER.LABEL" /></th>
				</tr>
				<% 
		   			for(WorkExperience wp: listWorkExperience){
		   				%>
				<tr class="WorkExperienceDate">
					<td colspan="2">
						<p></p>
					</td>
				</tr>

				<tr class="WorkExperienceDate">
					<td class="colParam"><fmt:message
							key="WORKEXPERIENCE.EPERIENCE.TABLE.DATES.LABEL" />:</td>
					<td class="colValue"><%=wp.getHTMLDates() %></td>
				</tr>

				<tr class="WorkExperienceOccupation">
					<td class="colParam"><fmt:message
							key="WORKEXPERIENCE.EPERIENCE.TABLE.OCCUPATION.LABEL" />:</td>
					<td class="colValue"><%=wp.getWorkOccupation() %></td>
				</tr>

				<tr class="WorkExperienceActivities">
					<td class="colParam"><fmt:message
							key="WORKEXPERIENCE.EPERIENCE.TABLE.ACTIVITIES.LABEL" />:</td>
					<td class="colValue"><%=wp.getWorkMainActivities() %></td>
				</tr>

				<tr class="WorkExperienceEmployerSpecifics">
					<td class="colParam"><fmt:message
							key="WORKEXPERIENCE.EPERIENCE.TABLE.EMPLOYERDATA.LABEL" />:</td>
					<td class="colValue"><%=wp.getHtmlEmployerSpec() %></td>
				</tr>

				<tr class="WorkExperienceBusinessType">
					<td class="colParam"><fmt:message
							key="WORKEXPERIENCE.EPERIENCE.TABLE.BUSINESSTYPE.LABEL" />:</td>
					<td class="colValue"><%=wp.getWorkBusinessSector() %></td>
				</tr>
				<%
		   			}
	   				%>
			</table>
			<%
   				}
	   		%>
		</div>
		
		<div id="modalForm">
			<form id="formWorkExperience" class="formExperience"
				action="../addinfo" method="post">
				<fieldset id="fsetWorkExperience" class="fsetWizard">
					<legend>
						<fmt:message key="WORKEXPERIENCE.FORM.LABEL" />:
					</legend>
					<div id="divWorkDates">
						<label id="lblDates" for="dateFromDate" class="WizardSection">
							<fmt:message key="WORKEXPERIENCE.FORM.DATES.START.LABEL" />:
						</label>
						<input type="date" id="dateFromDate" name="workStartDate" />
						
						<label id="lblEndDate" for="dateEndDate"> 
							<fmt:message key="WORKEXPERIENCE.FORM.DATES.END.LABEL" />:
						</label> 
						<input type="date" id="dateEndDate" name="workEndDate" />	
					</div>

					<div id="divOccupation">
						<label id="lblOccupation" for="txtOccupation" class="WizardMainLabel"> 
							<fmt:message key="WORKEXPERIENCE.FORM.OCCUPATION.LABEL" />:
						</label> 
						<input type="text" id="txtOccupation" name="workOccupation" maxlength="35" />
					</div>

					<div id="divMainActiviteis">
						<label id="lblActiviteis" for="txtMainActiviteis" class="WizardMainLabel"> 
							<fmt:message key="WORKEXPERIENCE.FORM.MAINACTIVITES.LABEL" />:
						</label>
						<textarea id="txtMainActiviteis" name="workMainActiviteis" rows="8" cols="20"></textarea>
					</div>

					<div id="divEmployerName">
						<label id="lblEmployerName" for="txtEmployerName" class="WizardMainLabel">
							<fmt:message key="WORKEXPERIENCE.FORM.EMPLOYERNAME.LABEL" />:
						</label> 
						<input type="text" id="txtEmployerName" name="workEmployerName" maxlength="35" />
					</div>

					<div id="divEmployerSirName">
						<label id="lblEmployerSirName" for="txtEmployerSirName" class="WizardMainLabel">
							<fmt:message key="WORKEXPERIENCE.FORM.EMPLOYESIRNAME.LABEL" />:
						</label> 
						<input type="text" id="txtEmployerSirName" name="workEmployerSirName" maxlength="35" />
					</div>

					<div id="divEmployerAddreass">
						<label id="lblEmployerAddreass" for="txtEmployerAddreass" class="WizardMainLabel">
							<fmt:message key="WORKEXPERIENCE.FORM.EMPLOYERADDRESS.LABEL" />:
						</label>
						<textarea id="txtEmployerAddreass" name="workEmployerAddress" rows="4" cols="20"></textarea>
					</div>

					<div id="divType">
						<label id="lblType" for="txtType" class="WizardMainLabel">
							<fmt:message key="WORKEXPERIENCE.FORM.TYPE.LABEL" />:
						</label> 
						<input type="text" id="txtType" name="workType" maxlength="35" />
					</div>
				</fieldset>

				<input type="hidden" value="1" name="numberCVWizardStep" />

				<button type="submit">
					<fmt:message key="SUBMIT.BUTTON" />
				</button>
			</form>
		</div>
		<button id="next" onclick="window.location.href = 'educationwizard.jsp'">next</button>
	</div>
</body>
</html>